import React from 'react';
import { connect } from 'react-redux'
// import * as types from './store/types'
import {minus,add,changeColor} from './store/actions'
class Button extends React.Component {
  add = () => {
    //修改redux中的数据
    // this.props.dispatch({type:types.ADD,qqq:20})
    // this.props.dispatch({type:types.CHNAGE_COLOR,col:'blue'})
    this.props.dispatch(add(20))
    this.props.dispatch(changeColor('blue'))
  }
  minus = () => {
    // this.props.dispatch({type:types.MINUS,qqq:100})
    this.props.dispatch(minus(100))
  }
  render() {
    console.log(this.props)
    return <div className=''>
      <button onClick={this.add}>+</button>
      <button onClick={this.minus}>-</button>
    </div>;
  }
}
Button = connect((state) => {
  return {}
}, (dispatch) => {
  return {
    dispatch
  }
})(Button)
export default Button